﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace Common
{
    public class Utility
    {
        public static bool CheckMobilePhone(string phone)
        {
            if(phone.Length == 11)
            {
                return Regex.IsMatch(phone, @"13[0123456789]\d{8}|15[0123456789]\d{8}|1[0123456789]\d{8}/");
            }
            return false;
        }
        public static bool CheckMail(string email)
        {
            if (Regex.IsMatch(email, @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"))
                return true;
            return false;
        }
        public static bool CheckQQ(string qq)
        {
            if (Regex.IsMatch(qq, @"^[1-9]*[1-9][0-9]*$"))
                return true;
            return false;
        }
        public static bool CheckPhone(string phone)
        {
            if (Regex.IsMatch(phone, @"^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$"))
                return true;
            return false;
        }
    }
}
